package framework.spatial;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;

/**
 *
 * @author Lukáš Marek
 */
public abstract class FRDSpatialGItem
{	
	protected int id;
	protected FRDSpatialMapBackground back;
	protected boolean selected = false;
	protected Color defaultColor = new Color(0, 255, 0, 60);
	protected Color SelectedColor = new Color(0, 0, 255, 60);
	protected Color editColor = Color.red;

	/**
	 * Vykresleni kompletniho objektu
	 * @param g 
	 */
	abstract public void draw(Graphics g);

	/**
	 * Nastaveni aktualnich dvou bodu
	 * @param pt1
	 * @param pt2
	 * @return 
	 */
	abstract public boolean addPoints(Point pt1, Point pt2);
	
	/**
	 * Ulozeni aktualnich dvou bodu
	 * @param pt1
	 * @param pt2 
	 */
	abstract public void setPoints(Point pt1, Point pt2);

	/**
	 * Vykresleni objektu pokud je editovan
	 * @param g
	 * @param pt1
	 * @param pt2 
	 */
	abstract public void drawEdit(Graphics g, Point pt1, Point pt2);
	
	/**
	 * Ulozeni bodu pri dokonceni editovani
	 * @param pt1
	 * @param pt2 
	 */
	abstract public void saveEdit(Point pt1, Point pt2);
	
	/**
	 * Test jestli je objekt pod mysi
	 * @param _p bod
	 * @return true pokud je pod mysi
	 */
	abstract public boolean undermouse(Point _p);
	
	public void setBack(FRDSpatialMapBackground b)
	{
		this.back = b;
	}
	
	public boolean isSelected()
	{
		return selected;
	}

	public void setSelected(boolean selected)
	{
		this.selected = selected;
	}
	
	public Color getSelectedColor()
	{
		return SelectedColor;
	}

	public void setSelectedColor(Color SelectedColor)
	{
		this.SelectedColor = SelectedColor;
	}

	public Color getDefaultColor()
	{
		return defaultColor;
	}

	public void setDefaultColor(Color defaultColor)
	{
		this.defaultColor = defaultColor;
	}
	
	public Color getEditColor()
	{
		return editColor;
	}

	public void setEditColor(Color defaultColor)
	{
		this.editColor = defaultColor;
	}
	
	public void setId(int id)
	{
		this.id = id;
	}
	
	public int getId()
	{
		return id;
	}
}
